package cloud.maque.swagger.conf;


import cloud.maque.conf.MaqueProperties;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Contact;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.info.License;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class Knife4jConfig {


    @Autowired
    MaqueProperties properties;

    @Bean
    public OpenAPI openAPI() {
        return new OpenAPI().info(new Info().title(properties.getSwagger().getTitle())
                .description(properties.getSwagger().getDescription())
                .version(properties.getSwagger().getVersion())
                .license(new License().name(properties.getSwagger().getLicense()).url(properties.getSwagger().getLicenseUrl()))
                .contact(new Contact().name(properties.getSwagger().getAuthor())));
    }
}
